<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style/css/main.css" rel="stylesheet" type="text/css" />
<script src="style/js/jquery.js" type="text/javascript"></script>
<script src="style/js/main.js" type="text/javascript"></script>
<title>系统信息</title>
</head>

<body>
<div class="main">
<?php
if(!isset($edit) && !isset($look) && !isset($bk_add))
{
?>
<table id="main_table">
    <tr>
        <th colspan="10" align="left"><?php echo $title;?></th>
    </tr>
    <tr>
        <td align="center" width="8%">编号</td>
        <td align="center" width="22%">图书名称</td>
        <td align="center" width="10%">图书分类</td>
        <td align="center" width="12%">出版社</td>
        <td align="center" width="7%">页数</td>
        <td align="center" width="9%">作者</td>
        <td align="center" width="7%">定价</td>
        <td align="center" width="6%">借阅次数</td>
        <td align="center" width="8%">库存</td>
        <td align="center" width="12%">操作</td>
    </tr>
    <?php
    if(!empty($page_books))
    {
    	foreach($page_books as $v)
    	{
    ?>
    <tr>
        <td align="center"><?php echo $v['bid']?></td>
        <td align="left" class="indent">
        <?php
        if(isset($recyle) && $recyle == 'Y')
        {
        ?>
        <?php echo $v['name']?>
        <?php
        }
        else
        {
        ?>
        <a href="books_main.php?action=look&tbid=<?php echo $v['bid']?>"><?php echo $v['name']?></a>
        <?php
        }
        ?></td>
        <td align="center"><?php echo $v['value']?></td>
        <td align="center"><?php echo $v['pstore']?></td>
        <td align="center"><?php echo $v['page']?></td>
        <td align="center"><?php echo $v['author']?></td>
        <td align="center"><?php echo $v['price']?></td>
        <td align="center"><?php echo $v['times']?></td>
        <td align="center"><?php echo $v['storage']?></td>
        <td align="center">
       
        <?php
        if(isset($recyle) && $recyle == 'Y')
        {
        ?>
        <a href="books_main.php?action=recyle_back&tbid=<?php echo $v['bid']?>" class="edit_img">[还原]</a>
        <a href="books_main.php?action=recyle_del&tbid=<?php echo $v['bid']?>" name="del_books" class="del_img">[清除]</a>
        <?php
        }
        else
        {
        ?>
        <a href="books_main.php?action=edit&tbid=<?php echo $v['bid']?>" class="edit_img">[编辑]</a>
        <a href="books_main.php?action=del&tbid=<?php echo $v['bid']?>" name="del_books" class="del_img">[删除]</a>
        <?php
        }
        ?>
        </td>
    <?php
    	}
    }
    else
    {
    ?>
    <td align="center" colspan="10">暂无图书</td>
    <?php
   	}
    ?>
    <?php if(!isset($notnav))
    { 
    ?>
    <tr class="no">
        <td colspan="10" align="center" class="pager"><?php echo $pagenav;?></td>
    </tr>
    <?php
    }
    ?>
    <tr>
    	<td colspan="10" align="center">
        <form action="books_main.php" method="post">
        <input type="text" class="midtext" name="search_book" value="搜索" />
        <select name="title">
        	<option value="name" <?php echo $dis == 'name' ? 'selected="selected"' : '';?>>图书名称</option>
        	<option value="pstore" <?php echo $dis == 'pstore' ? 'selected="selected"' : '';?>>出版社</option>
        	<option value="author" <?php echo $dis == 'author' ? 'selected="selected"' : '';?>>作者</option>
        	<option value="type" <?php echo $dis == 'type' ? 'selected="selected"' : '';?>>图书类别</option>
        </select>
        <input type="submit" class="btn2" name="search_book_btn" value="搜索" />
        </form>
        </td>
    </tr>
</table>
<?php
}
else if(isset($edit))
{
?>
<table>
<form action="books_main.php" method="post" enctype="multipart/form-data">
  	<tr>
        <th colspan="2" align="left"><?php echo $title;?></th>
    </tr>
  	<tr>
        <td align="center" width="20%">编号:</td>
        <td align="left" class="indent" width="80%">
        <input type="text" class="midtext" readonly="readonly" name="bid" value="<?php echo $edit;?>" /></td>
    </tr>
  	<tr>
        <td align="center">图书名称:</td>
        <td align="left" class="indent">
        <input type="text" class="midtext" name="name" value="<?php echo isset($result) ? $result['name'] : '';?>" /></td>
    </tr>
    
  	<tr>
        <td align="center">图书类型：</td>
        <td align="left" class="indent">
        <select name="value">
        	<?php
            foreach($class as $k=>$v)
            {
            ?>
            	<option value="<?php echo $v['id'];?>" <?php if($result['typeid'] == $v['id']) echo 'selected="selected" style="background-color:#0C9"';?>>
                <?php echo $v['value']?></option>
            <?php
            }
            ?>
        </select></td>
    </tr>
    
  	<tr>
        <td align="center">作者：</td>
        <td align="left" class="indent">
        <input type="text" class="midtext" name="author" value="<?php echo $result['author'];?>" /></td>
    </tr>
    
  	<tr>
        <td align="center">出版社：</td>
        <td align="left" class="indent">
        <input type="text" class="midtext" name="pstore" value="<?php echo $result['pstore'];?>" /></td>
    </tr>
    <tr>
        <td align="center">出版日期：</td>
        <td align="left" class="indent">
        <input type="text" class="shorttext" name="pdate" value="<?php echo $result['pdate'];?>" />&nbsp;
        手动修改请注意格式YYYY-mm-dd</td>
    </tr>
  	<tr>
        <td align="center">价格：</td>
        <td align="left" class="indent">
        <input type="text" class="littleshorttext" name="price" value="<?php echo $result['price'];?>" />&nbsp;元</td>
    </tr>
   <tr>
        <td align="center">页数：</td>
        <td align="left" class="indent">
        <input type="text" class="littleshorttext" name="page" value="<?php echo $result['page'];?>" />&nbsp;页</td>
    </tr>
   <tr>
        <td align="center">库存：</td>
        <td align="left" class="indent">
        <input type="text" class="littleshorttext" name="storage" value="<?php echo $result['storage'];?>" />&nbsp;本</td>
    </tr>
   <tr>
        <td align="center">是否推荐：</td>
        <td align="left" class="indent">
        <input type="radio" name="tuijian" value="1" <?php echo $result['tuijian'] == 1 ? 'checked="checked"' : '';?> />是&nbsp;
        <input type="radio" name="tuijian" value="0" <?php echo $result['tuijian'] == 0 ? 'checked="checked"' : '';?> />否&nbsp;
        </td>
    </tr>
    <tr>
    	<td align="center">内容简介：</td>
    	<td align="left" class="indent">
        <textarea name="content" cols="50" rows="5"><?php echo isset($result['content']) ? $result['content'] : '';?></textarea>
        </td>
    </tr>
    <tr>
    	<td align="center">缩略图：</td>
    	<td align="left" class="indent">
        <?php echo !empty($result['pic']) ? '<img src="' . $result['pic'] . '" />' : '';?>
        <input type="file" name="pic" class="fileput" />
        </td>
    </tr>
       <tr>
        <td align="center" colspan="2">
        <input type="submit" class="btn" name="edit_submit" value="修改" />
        <input type="reset" class="btn" value="重置" />
        <input type="buttin" class="btn" value="返回" onclick="history.go(-1)" />
        </td>
    </tr>
    </form>
</table>
<?php
}
else if(isset($look))
{
?>
<!--查看图书信息-->
<table id="main_table">
    <tr>
        <th colspan="10" align="left"><?php echo $title;?></th>
    </tr>
    <tr>
    	<td width="30%" align="center">编号：</td>
        <td width="70%" class="indent" align="left"><?php echo $result['bid'];?></td>
    </tr>
    <tr>
    	<td align="center">图书名称：</td>
    	<td class="indent" align="left"><?php echo $result['name']?></td>
    </tr>
    <tr>
    	<td align="center">图书分类：</td>
    	<td class="indent" align="left"><?php echo $result['value']?></td>
    </tr>
    <tr>
    	<td align="center">作者：</td>
    	<td class="indent" align="left"><?php echo $result['author']?></td>
    </tr>
    <tr>
    	<td align="center">出版社：</td>
    	<td class="indent" align="left"><?php echo $result['pstore']?></td>
    </tr>
    <tr>
    	<td align="center">出版日期：</td>
    	<td class="indent" align="left"><?php echo $result['pdate']?></td>
    </tr>
    <tr>
    	<td align="center">价格：</td>
    	<td class="indent" align="left"><?php echo $result['price']?></td>
    </tr>
    <tr>
    	<td align="center">页数：</td>
    	<td class="indent" align="left"><?php echo $result['page']?></td>
    </tr>
    <tr>
    	<td align="center">入库时间：</td>
    	<td class="indent" align="left"><?php echo $result['indate']?></td>
    </tr>
    <tr>
    	<td align="center">库存：</td>
    	<td class="indent" align="left"><?php echo $result['storage']?>&nbsp;本</td>
    </tr>
    <tr>
    	<td align="center">借阅次数：</td>
    	<td class="indent" align="left"><?php echo $result['times']?></td>
    </tr>
    <tr>
    	<td align="center">是否推荐：</td>
    	<td class="indent" align="left"><?php echo $result['tuijian'] == 1 ? '是' : '否'; ?></td>
    </tr>
    <tr>
    	<td align="center">内容简介：</td>
    	<td class="indent" align="left"><?php echo $result['content']; ?></td>
    </tr>
    <tr>
    	<td align="center">缩略图：</td>
    	<td class="indent" align="left"><?php echo !empty($result['pic']) ? '<img src="' . $result['pic'] . '" />' : '';?></td>
    </tr>
    <tr>
    	<td align="center" colspan="2">
        <input type="button" value="添加图书" onclick="location.href='books_main.php?action=add'" class="btn3" />
        <input type="button" value="返回" class="btn3_s" onclick="history.go(-1)" />
        </td>
    </tr>
</table>
<?php
}
else if(isset($bk_add))
{
?>
<!--添加页面-->
<table id="main_table">
<form action="books_main.php" method="post" enctype="multipart/form-data">
    <tr>
        <th colspan="10" align="left"><?php echo $title;?></th>
    </tr>
    <tr>
    	<td align="center" width="30%">图书名称：</td>
    	<td class="indent" width="70%" align="left"><input type="text" name="name" class="midtext" /></td>
    </tr>
    <tr>
    	<td align="center">图书分类：</td>
    	<td class="indent" align="left">
        	<select name="value">
            	<?php foreach($class as $v)
                {
                ?>
                <option value="<?php echo $v['id']?>"><?php echo $v['value'];?></option>
                <?php
                }
                ?>
            </select>
        </td>
    </tr>
    <tr>
    	<td align="center">作者：</td>
    	<td class="indent" align="left"><input type="text" name="author" class="shorttext" /></td>
    </tr>
    <tr>
    	<td align="center">出版社：</td>
    	<td class="indent" align="left"><input type="text" name="pstore" class="midtext" /></td>
    </tr>
    <tr>
    	<td align="center">出版日期：</td>
    	<td class="indent" align="left"><input type="text" name="pdate" value="<?php echo date('Y-m-d', time()-30*24*60*60);?>" class="shorttext" />&nbsp;
        请注意格式YYYY-mm-dd</td>
    </tr>
    <tr>
    	<td align="center">价格：</td>
    	<td class="indent" align="left"><input type="text" name="price" class="littleshorttext" /></td>
    </tr>
    <tr>
    	<td align="center">页数：</td>
    	<td class="indent" align="left"><input type="text" name="page" class="littleshorttext" /></td>
    </tr>
    <tr>
    	<td align="center">入库时间：</td>
    	<td class="indent" align="left"><input type="text" name="indate" value="<?php echo date('Y-m-d', time());?>" class="shorttext" />&nbsp;请注意格式YYYY-mm-dd</td>
    </tr>
    <tr>
    	<td align="center">库存：</td>
    	<td class="indent" align="left"><input type="text" name="storage" class="littleshorttext" />&nbsp;本</td>
    </tr>
    <tr>
    	<td align="center">是否推荐：</td>
    	<td class="indent" align="left">
        <input type="radio" name="tuijian" value="1" checked="checked" />是&nbsp;
        <input type="radio" name="tuijian" value="0" />否&nbsp;
        </td>
    </tr>
    <tr>
    	<td align="center">内容简介：</td>
    	<td align="left" class="indent">
        <textarea name="content" cols="50" rows="5"></textarea>
        </td>
    </tr>
    <tr>
    	<td align="center">缩略图：</td>
    	<td align="left" class="indent">
        <input type="file" name="pic" class="fileput" />
        </td>
    </tr>
    <tr>
    	<td align="center" colspan="2">
        <input type="submit" value="添加" class="btn3_s" name="books_add_sub" />
        <input type="button" value="返回" class="btn3_s" onclick="history.go(-1)" />
        </td>
    </tr>
    </form>
</table>
<?php
}
?>
</div>
<?php echo $copyright;?>
</body>
</html>
